// ValidationAspects
// Written by Mike Saunders
// Released under Microsoft Public License (Ms-PL)
using System;
using ValidationAspects.Sdk;

namespace ValidationAspects.Exceptions
{
	public class ValidateNotEqualException : ValidationException
	{
		public static Func<ValidateNotEqualException, string> MessageFormat { get; set; }

		static ValidateNotEqualException()
		{
			ResetMessageFormat();
		}

		public ValidateNotEqualException(double value)
		{
			Value = value;
		}

		public ValidateNotEqualException(string value, bool ignoreCase)
		{
			Enforce.IsNotNull(value, "value");
			Value = value;
			IgnoreCase = ignoreCase;
		}

		public static void ResetMessageFormat()
		{
			MessageFormat = e => string.Format("{0} must not equal {1}.", e.GetValidationTargetName(), e.Value);
		}

		public override string Message
		{
			get { return MessageFormat(this); }
		}

		public object Value { get; private set; }
		public bool IgnoreCase { get; private set; }
	}
}